package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.Travel;
import cn.wolfcode.trip.base.domain.User;
import cn.wolfcode.trip.base.query.DailyQueryObject;
import cn.wolfcode.trip.base.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface TravelMapper {

    int insert(Travel record);

    Travel selectByPrimaryKey(Long id);

    List<Travel> selectAll();

    List<Travel> selectList(QueryObject qo);

    int updateByPrimaryKey(Travel record);

    void updateState(Travel travel);

    void updateViewCount(Travel travel);

    List<Travel> selsectRegionHotTravel(QueryObject qo);


    List<Travel> selectDaily(DailyQueryObject qo);

    /**
     * 根据游记id查询游记点赞量
     * @param travelId
     * @return
     */
    Integer getLikeCount(Long travelId);


    /**
     * 根据游记ID查询作者
     * @param travelId 游记id
     * @return 游记作者id
     */
    User getAuthorByTravelId(Long travelId);

    void updateLikeCount(@Param("travelId") Long travelId, @Param("count") int count);
}